<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>oss文件管理</title>

    <script type="text/javascript" src="js/jquery.min.js"></script>
    <script>
			var pre = 'http://laoxu-xuejava.oss-cn-guangzhou.aliyuncs.com/';
			$(function() {
				listfile();
			});

			//文件列表
			function listfile() {
				$.ajax({
					url: "http://localhost:9999/file/list",
					type: 'POST',
					success: function(rtn) {

						for (var i = 0; i < rtn.length; i++) {
							console.log(rtn[i].key);
						}
					}
				});
			}

			//文件下载
			function downloadfile(src) {
				var fileName = src.split(pre)[1];
				window.location.href = "http://localhost:9999/file/download?fileName=" + fileName;
			}

			//文件删除
			function deletefile(src) {
				var fileName = src.split(pre)[1];
				var param = {
					fileName: fileName
				};
				$.ajax({
					url: "http://localhost:9999/file/delete",
					data: param,
					success: function() {
						alert('删除成功', fileName);
						//删除页面
						location.reload();
					}
				});
			}
		</script>


</head>
<body>
单击下载oss上的图片、双击删除oss上的图片<br>
<div>

</div>
</body>
</html>
